package com.ysm.kotlin.viewmodel

import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.ViewModel
import androidx.lifecycle.viewModelScope
import com.ysm.kotlin.repository.UserRepository
import kotlinx.coroutines.launch

class MainViewModel : ViewModel() {

    val userLiveData = MutableLiveData<String>("Model xxx")

    val userRepository : UserRepository = UserRepository()

    fun getUserName() {
        viewModelScope.launch {
            userLiveData.value = userRepository.getUserName(userLiveData.value.toString())
//            userLiveData.postValue(userLiveData.value+"====")

        }
    }

}